package kgame5.k3d.core.obj3d.node3d.group3d {
import kgame5.k3d.core.obj3d.node3d.Group3D;
import kgame5.k3d.core.obj3d.node3d.Node3D;
import kgame5.k3d.core.render.RenderSessionData;
import kgame5.k3d.core.render.layerrender.impl.Group3DLayerRender;

import flash.display.Sprite;

/**
 * @author kk
 * 对child不排序,按添加顺序
 */
public class FastGroup3D extends Group3D{
	
	//_____________________Property_________________________
	private var mc:Sprite;
	//______________________Method__________________________
	//p_sortLayer是是否参与排序,sortType是自己排序内部的东西
	public function FastGroup3D(){//sortType=2是ccz_bornID
		super();
		
		//-这样主要是FastGroup3D和GoodGroup3D用的
		renderer=new Group3DLayerRender();	
		mc=renderer.getDO() as Sprite;
	}
	
	
	
	//------针对child列表的操作
	override public function addChild(md:Node3D):void{
		
		super.addChild(md);
		
		//视图加。放在不需要排序的图层
		mc.addChild(md.getDO());
	}
	
	//删除，操作是从2个数组里删掉，并不dispose,只是从显示列表中移开而已
	override public function removeChild(md:Node3D):void{
		
		super.removeChild(md);
			
		//视图删除mc
		try{
			mc.removeChild(md.getDO());
		}catch(e:Error){
			//这个不存在，不能删除
		}
	}
	override public function removeAllChild():void{
		//-视图删除
		for each(var md:Node3D in aChild){
			mc.removeChild(md.getDO());
		}
		//-
		super.removeAllChild();
		
	}
	
	override public function Update(rsd:RenderSessionData,isParentDirty:Boolean):void{
		//--
		if(isVisible()==false){
			return ;
		}
		
		//--
		ti.calcMoc_Full(parentNode.ti.Mow,rsd.Mwc, rsd.isMwcDirty,isParentDirty);
		
		//--
		mc.visible=true;
		
		//--各个模型
		for each(var md:Node3D in aChild){
			md.Update(rsd, this.ti.isNeedRedraw);
		}
	}
}//end of class
}
